using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MCromwell.StaffIntranet.Presenters;
using MCromwell.StaffIntranet.DTO;

namespace MCromwell.StaffIntranet.UI
{
    public partial class StaffIntranet : MasterPage, ICommonView
    {
        private CommonPresenter presenter;

        protected void Page_Load(object sender, EventArgs e)
        {
            InitializePresenter();
        }

        protected void InitializePresenter()
        {
            presenter = new CommonPresenter(this);
            presenter.Initialize(LoginManager.RetrieveCurrentSessionIdentifer());
        }

        public AdministratorDTO CurrentAdministrator
        {
            set {
                if (value != null)
                {
                    loggedon.InnerText = string.Format("logged on as {0}", value.Username);
                    login.Visible = false;
                    logout.Visible = true;
                    addstaff.Visible = true;
                    locations.Visible = true;
                }
                else
                {
                    login.Visible = true;
                    logout.Visible = false;
                    addstaff.Visible = false;
                    locations.Visible = false;
                }
            }
        }

    }
}
